﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PMS.ENT;
using PMS.DAL;

namespace PMS.BLL
{
    public class UserGroupBLL
    {
        #region Get
        public static UserGroupENT GetUserGroupByID(int groupID)
        {
            try
            {
                return UserGroupDAL.GetUserGroupByID(groupID);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static UserGroupCollection GetUserGroupList(string orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
        {
            try
            {
                return UserGroupDAL.GetUserGroupList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static UserGroupCollection GetUserGroupListForCMB(int userID, int groupID)
        {
            try
            {
                UserGroupCollection listUserGroup = new UserGroupCollection();
                listUserGroup.Add(new UserGroupENT { UserGroupID = 0, UserID = 0, GroupID = 0 });
                listUserGroup.AddRange(UserGroupDAL.GetUserGroupListForCMB());
                return listUserGroup;
            }
            catch (Exception)
            {

                throw;
            }
        }

        public static UserGroupCollection GetUserGroupListByGroupID(int groupID)
        {
            try
            {
                return UserGroupDAL.GetUserGroupListByGroupID(groupID);
            }
            catch (Exception)
            {
                throw;
            }
        }


        #endregion

        #region Insert Update Delete Confirm

        public static int InsertUserGroup(UserGroupENT group)
        {
            try
            {
                return UserGroupDAL.InsertUserGroup(group);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public static int UpdateUserGroup(UserGroupENT group)
        {
            try
            {
                return UserGroupDAL.UpdateUserGroup(group);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public static int DeleteUserGroup(string groupID, int userID)
        {
            try
            {
                return UserGroupDAL.DeleteUserGroup(groupID, userID);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public static int ConfirmGroup(string usergroupID, int userID,string status)
        {
            try
            {
                return UserGroupDAL.ConfirmUserGroup(usergroupID, userID, status);
            }
            catch (Exception)
            {

                throw;
            }
        }

        #endregion


    }
}
